//
//  CoreDateManager.h
//  CarService
//
//  Created by fengyn on 15/2/11.
//  Copyright (c) 2015年 lexingsoft. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

/// CoreData工具类
@interface CoreDateManager : NSObject
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

// 获取使用实例
+ (instancetype )sharedInstance;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;

//插入数据
- (void)insertEntitys:(NSArray *)entitys;
- (void)insertObject:(NSManagedObject **)object withEntityName:(NSString *)entityName;
/// 查询
- (NSMutableArray*)selectData:(int)pageSize andOffset:(int)currentPage withEntityName:(NSString *)entityName;
/// 删除
- (void)deleteAllWithEntityName:(NSString *)entityName;
/// 更新
- (void)updateData:(NSString*)newsId  withIsLook:(NSString*)islook withEntityName:(NSString *)entityName;
@end
